import sys

list = [1,2,3,4]
it = iter(list) #create a iter class
# for x in it:
# for x in list:
    # print(x,end = " ")
while True:
    try:
        print(next(it))
    except StopIteration:
        sys.exit()